# 保存图片，视频
import requests
import os
import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')

url = 'https://edu-image.nosdn.127.net/3321D6673EB82C94D08E1B80E8344166.jpg'
root = 'E://pics//'
path = root + url.split('/')[-1]


try:
	if not os.path.exists(root):
		os.mkdir(root)
	if not os.path.exists(path):
		r = requests.get(url)
		with open(path,'wb') as f:
			f.write(r.content)
			f.close()
			print('文件保存成功')
	else:
		print('文件已保存')
except:
	print('读取失败')